import React, { Component } from 'react'
import Table from './Table'

export default class Index extends Component {
  state = {
    users: [
      {
        date: '2016-05-03',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
        tag: 'Home'
      },
      {
        date: '2016-05-02',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
        tag: 'Office'
      },
      {
        date: '2016-05-04',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
        tag: 'Home'
      },
      {
        date: '2016-05-01',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
        tag: 'Office'
      }
    ]
  }

  render () {
    return (
      <div>
        <Table
          dataSource={this.state.users}
          render={record => {
            if (record.tag === 'Home') {
              return <div style={{ color: 'blue' }}>{record.tag}</div>
            } else {
              return <div style={{ color: 'green' }}>{record.tag}</div>
            }
          }}
        />
      </div>
    )
  }
}
